package com.sunnada.wfs.dao;

import org.apache.ibatis.jdbc.SQL;

import java.util.Map;

public class SystemInfoSql {

    private String tableName = "system_info";

    public String insert(Map<String, String> map) {
        String sql = new SQL() {{
            INSERT_INTO(tableName);
            VALUES("ip", "#{ip}");
            VALUES("system_info", "#{systemInfo}");
        }}.toString();
        return sql;
    }

    public String get(String ip) {
        String sql = new SQL() {{
            SELECT("ip,system_info");
            FROM(tableName);
            WHERE("ip=#{ip}");
            ORDER_BY("create_time desc limit 1");
        }}.toString();
        System.out.println(sql);
        return sql;
    }

    public String getAll() {
        String sql = new SQL() {{
            SELECT("ip,system_info");
            FROM(tableName);
        }}.toString();
        System.out.println(sql);
        return sql;
    }
}
